Add direct link to the Single-Sign On provider if there is only one sign up method available (#26083)
This commit is contained in:
parent
a5768d3ea6
commit
120f5802c0
8 changed files with 82 additions and 33 deletions
|
@ -13,7 +13,7 @@ import { openModal, closeModal } from 'mastodon/actions/modal';
|
|||
import api from 'mastodon/api';
|
||||
import Button from 'mastodon/components/button';
|
||||
import { Icon } from 'mastodon/components/icon';
|
||||
import { registrationsOpen } from 'mastodon/initial_state';
|
||||
import { registrationsOpen, sso_redirect } from 'mastodon/initial_state';
|
||||
|
||||
const messages = defineMessages({
|
||||
loginPrompt: { id: 'interaction_modal.login.prompt', defaultMessage: 'Domain of your home server, e.g. mastodon.social' },
|
||||
|
@ -331,18 +331,36 @@ class InteractionModal extends React.PureComponent {
|
|||
}
|
||||
|
||||
let signupButton;
|
||||
let signUpOrSignInButton;
|
||||
|
||||
if (registrationsOpen) {
|
||||
signupButton = (
|
||||
<a href='/auth/sign_up' className='link-button'>
|
||||
<FormattedMessage id='sign_in_banner.create_account' defaultMessage='Create account' />
|
||||
if (sso_redirect) {
|
||||
signUpOrSignInButton = (
|
||||
<a href={sso_redirect} data-method='post' className='button button--block button-tertiary'>
|
||||
<FormattedMessage id='sign_in_banner.sso_redirect' defaultMessage='Login or Register' />
|
||||
</a>
|
||||
);
|
||||
)
|
||||
} else {
|
||||
signupButton = (
|
||||
<button className='link-button' onClick={this.handleSignupClick}>
|
||||
<FormattedMessage id='sign_in_banner.create_account' defaultMessage='Create account' />
|
||||
</button>
|
||||
if(registrationsOpen) {
|
||||
signupButton = (
|
||||
<a href='/auth/sign_up' className='link-button'>
|
||||
<FormattedMessage id='sign_in_banner.create_account' defaultMessage='Create account' />
|
||||
</a>
|
||||
);
|
||||
} else {
|
||||
signupButton = (
|
||||
<button className='button button--block button-tertiary' onClick={this.handleSignupClick}>
|
||||
<FormattedMessage id='sign_in_banner.create_account' defaultMessage='Create account' />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
signUpOrSignInButton = (
|
||||
<>
|
||||
<a href='/auth/sign_in' className='button button--block'>
|
||||
<FormattedMessage id='sign_in_banner.sign_in' defaultMessage='Login' />
|
||||
</a>
|
||||
{signupButton}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -353,6 +371,13 @@ class InteractionModal extends React.PureComponent {
|
|||
<p>{actionDescription} <strong><FormattedMessage id='interaction_modal.sign_in' defaultMessage='You are not logged in to this server. Where is your account hosted?' /></strong></p>
|
||||
</div>
|
||||
|
||||
<div className='interaction-modal__choices'>
|
||||
<div className='interaction-modal__choices__choice'>
|
||||
<h3><FormattedMessage id='interaction_modal.on_this_server' defaultMessage='On this server' /></h3>
|
||||
{signUpOrSignInButton}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<IntlLoginForm resourceUrl={url} />
|
||||
|
||||
<p className='hint'><FormattedMessage id='interaction_modal.sign_in_hint' defaultMessage="Tip: That's the website where you signed up. If you don't remember, look for the welcome e-mail in your inbox. You can also enter your full username! (e.g. @Mastodon@mastodon.social)" /></p>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue