Add linked accounts section to user settings page (#1705)
Add linked accounts section to user settings page GitOrigin-RevId: d2bb26a3bfb3946144a05b98f58d50a2c57f3040
This commit is contained in:
committed by
sharelatex
parent
e2793f659c
commit
54186d9db1
@@ -31,6 +31,7 @@ module.exports = AuthenticationController =
|
||||
session_created: (new Date()).toISOString()
|
||||
ip_address: user._login_req_ip
|
||||
must_reconfirm: user.must_reconfirm
|
||||
v1_id: user.overleaf?.id
|
||||
callback(null, lightUser)
|
||||
|
||||
deserializeUser: (user, cb) ->
|
||||
@@ -160,6 +161,13 @@ module.exports = AuthenticationController =
|
||||
else
|
||||
return null
|
||||
|
||||
getLoggedInUserV1Id: (req) ->
|
||||
user = AuthenticationController.getSessionUser(req)
|
||||
if user?.v1_id?
|
||||
return user.v1_id
|
||||
else
|
||||
return null
|
||||
|
||||
getSessionUser: (req) ->
|
||||
if req?.session?.user?
|
||||
return req.session.user
|
||||
|
||||
@@ -18,6 +18,8 @@ module.exports = Features =
|
||||
return Settings.accountMerge? and Settings.overleaf? and !Settings.forceImportToV2
|
||||
when 'custom-togglers'
|
||||
return Settings.overleaf?
|
||||
when 'oauth'
|
||||
return Settings.oauth?
|
||||
when 'publish-templates'
|
||||
return true
|
||||
when 'view-templates'
|
||||
|
||||
@@ -9,9 +9,10 @@ block content
|
||||
.page-header
|
||||
h1 #{translate("account_settings")}
|
||||
.account-settings(ng-controller="AccountSettingsController", ng-cloak)
|
||||
|
||||
if hasFeature('affiliations')
|
||||
include settings/user-affiliations
|
||||
|
||||
|
||||
form-messages(for="settingsForm")
|
||||
.alert.alert-success(ng-show="settingsForm.response.success")
|
||||
| #{translate("thanks_settings_updated")}
|
||||
@@ -145,7 +146,7 @@ block content
|
||||
|
||||
| !{moduleIncludes("userSettings", locals)}
|
||||
hr
|
||||
|
||||
|
||||
h3
|
||||
| #{translate("sharelatex_beta_program")}
|
||||
|
||||
@@ -164,13 +165,16 @@ block content
|
||||
div
|
||||
a(id="sessions-link", href="/user/sessions") #{translate("manage_sessions")}
|
||||
|
||||
if settings.overleaf
|
||||
if settings.overleaf && !hasFeature('oauth')
|
||||
hr
|
||||
p
|
||||
| To manage your account's connection to Google, Twitter, ORCID and IEEE, please
|
||||
|
|
||||
a(href="/sign_in_to_v1?return_to=/users/edit#linked-accounts") click here
|
||||
| .
|
||||
else if hasFeature('oauth')
|
||||
hr
|
||||
include settings/user-oauth
|
||||
|
||||
hr
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
form.row(
|
||||
ng-controller="UserOauthController"
|
||||
name="oauthForm"
|
||||
ng-cloak
|
||||
)
|
||||
.col-xs-12
|
||||
h3.text-capitalize #{translate("linked_accounts")}
|
||||
p.small #{translate("linked_accounts_explained", {appName:'{{settings.appName}}'})}
|
||||
|
||||
div.text-center(ng-if="ui.isLoadingProviders")
|
||||
i.fa.fa-fw.fa-spin.fa-refresh(aria-hidden="true")
|
||||
| #{translate("loading")}...
|
||||
|
||||
ul(
|
||||
class="list-like-table"
|
||||
ng-if="ui.isLoadingProviders == false && ui.hasError == false"
|
||||
)
|
||||
li(ng-repeat="provider in providers")
|
||||
.row
|
||||
.col-xs-12.col-sm-8.col-md-10
|
||||
h4 {{provider.name}}
|
||||
p.small(ng-if="provider.key != 'orcid'")
|
||||
| #{translate("login_with_service", {service:'{{provider.name}}'})}
|
||||
p.small(ng-if="provider.key == 'orcid'")
|
||||
| !{translate('oauth_orcid_description', {link: '/blog/434'})}
|
||||
.col-xs-2.col-sm-4.col-md-2.text-right
|
||||
button.btn.btn-default(ng-if="userProviders[provider.key]") #{translate("unlink")}
|
||||
button.btn.btn-primary(ng-if="!userProviders[provider.key]") #{translate("link")}
|
||||
|
||||
.alert.alert-danger(
|
||||
ng-if="ui.hasError"
|
||||
)
|
||||
i.fa.fa-fw.fa-exclamation-triangle(aria-hidden="true")
|
||||
span(ng-if="!ui.errorMessage") #{translate("error_performing_request")}
|
||||
span(ng-if="ui.errorMessage") {{ui.errorMessage}}
|
||||
Reference in New Issue
Block a user