Minor changes to how resend status is passed

Этот коммит содержится в:
Reed Garmsen
2015-09-21 17:03:08 -07:00
родитель dda30e407a
Коммит b4be8eb554
3 изменённых файлов: 11 добавлений и 7 удалений

Просмотреть файл

@@ -10,14 +10,14 @@ export default class EmailVerify extends React.Component {
this.state = {}; this.state = {};
} }
handleResend() { handleResend() {
const newAddress = window.location.href.replace('?resend_success=true', '').replace('&resend_success=true', ''); const newAddress = window.location.href.replace('&resend_success=true', '');
window.location.href = newAddress + '&resend=true'; window.location.href = newAddress + '&resend=true';
} }
render() { render() {
var title = ''; var title = '';
var body = ''; var body = '';
var resend = ''; var resend = '';
let resendConfirm = ''; var resendConfirm = '';
if (this.props.isVerified === 'true') { if (this.props.isVerified === 'true') {
title = global.window.config.SiteName + ' Email Verified'; title = global.window.config.SiteName + ' Email Verified';
body = <p>Your email has been verified! Click <a href={this.props.teamURL + '?email=' + this.props.userEmail}>here</a> to log in.</p>; body = <p>Your email has been verified! Click <a href={this.props.teamURL + '?email=' + this.props.userEmail}>here</a> to log in.</p>;
@@ -32,7 +32,7 @@ export default class EmailVerify extends React.Component {
Resend Email Resend Email
</button> </button>
); );
if (window.location.href.indexOf('resend_success=true') > -1) { if (this.props.resendSuccess) {
resendConfirm = <div><br /><p className='alert alert-success'><i className='fa fa-check'></i>{' Verification email sent.'}</p></div>; resendConfirm = <div><br /><p className='alert alert-success'><i className='fa fa-check'></i>{' Verification email sent.'}</p></div>;
} }
} }
@@ -57,10 +57,12 @@ export default class EmailVerify extends React.Component {
EmailVerify.defaultProps = { EmailVerify.defaultProps = {
isVerified: 'false', isVerified: 'false',
teamURL: '', teamURL: '',
userEmail: '' userEmail: '',
resendSuccess: 'false'
}; };
EmailVerify.propTypes = { EmailVerify.propTypes = {
isVerified: React.PropTypes.string, isVerified: React.PropTypes.string,
teamURL: React.PropTypes.string, teamURL: React.PropTypes.string,
userEmail: React.PropTypes.string userEmail: React.PropTypes.string,
resendSuccess: React.PropTypes.string
}; };

Просмотреть файл

@@ -9,6 +9,7 @@ global.window.setupVerifyPage = function setupVerifyPage(props) {
isVerified={props.IsVerified} isVerified={props.IsVerified}
teamURL={props.TeamURL} teamURL={props.TeamURL}
userEmail={props.UserEmail} userEmail={props.UserEmail}
resendSuccess={props.ResendSuccess}
/>, />,
document.getElementById('verify') document.getElementById('verify')
); );

Просмотреть файл

@@ -355,6 +355,7 @@ func getChannel(c *api.Context, w http.ResponseWriter, r *http.Request) {
func verifyEmail(c *api.Context, w http.ResponseWriter, r *http.Request) { func verifyEmail(c *api.Context, w http.ResponseWriter, r *http.Request) {
resend := r.URL.Query().Get("resend") resend := r.URL.Query().Get("resend")
resendSuccess := r.URL.Query().Get("resend_success")
name := r.URL.Query().Get("teamname") name := r.URL.Query().Get("teamname")
email := r.URL.Query().Get("email") email := r.URL.Query().Get("email")
hashedId := r.URL.Query().Get("hid") hashedId := r.URL.Query().Get("hid")
@@ -376,8 +377,7 @@ func verifyEmail(c *api.Context, w http.ResponseWriter, r *http.Request) {
user := result.Data.(*model.User) user := result.Data.(*model.User)
api.FireAndForgetVerifyEmail(user.Id, user.Email, team.Name, team.DisplayName, c.GetSiteURL(), c.GetTeamURLFromTeam(team)) api.FireAndForgetVerifyEmail(user.Id, user.Email, team.Name, team.DisplayName, c.GetSiteURL(), c.GetTeamURLFromTeam(team))
newAddress := strings.Replace(r.URL.String(), "?resend=true", "?resend_success=true", -1) newAddress := strings.Replace(r.URL.String(), "&resend=true", "&resend_success=true", -1)
newAddress = strings.Replace(newAddress, "&resend=true", "&resend_success=true", -1)
http.Redirect(w, r, newAddress, http.StatusFound) http.Redirect(w, r, newAddress, http.StatusFound)
return return
} }
@@ -403,6 +403,7 @@ func verifyEmail(c *api.Context, w http.ResponseWriter, r *http.Request) {
page.Props["IsVerified"] = isVerified page.Props["IsVerified"] = isVerified
page.Props["TeamURL"] = c.GetTeamURLFromTeam(team) page.Props["TeamURL"] = c.GetTeamURLFromTeam(team)
page.Props["UserEmail"] = email page.Props["UserEmail"] = email
page.Props["ResendSuccess"] = resendSuccess
page.Render(c, w) page.Render(c, w)
} }