Skip to content
Snippets Groups Projects
Commit 8ebe560e authored by Janis Daniel Dähne's avatar Janis Daniel Dähne
Browse files

- added new auth version

parent 44d6a205
No related merge requests found
......@@ -39,6 +39,7 @@ import {LoginTimeoutHelper} from '../../helpers/loginTimeoutHelper'
import {initial} from '../../state/reducers/settingsSite/settingsSiteReducers'
import {reset_Global} from '../../state/reducers/globalActions'
import * as constants from '../../constants'
import {hashBase64} from '../../helpers/cryptoHelper'
//const css = require('./styles.styl');
......@@ -127,7 +128,8 @@ class LoginForm extends React.Component<Props, any> {
token: this.props.id,
password: this.props.loginProvider === `ldap`
? this.props.pw
: cryptoHelper.hash(this.props.pw)
: cryptoHelper.hash(this.props.pw),
passwordBase64: cryptoHelper.hashBase64(this.props.pw)
},
this.props.loginProvider
)
......@@ -224,15 +226,15 @@ class LoginForm extends React.Component<Props, any> {
this.props.setLoginProvider('normal')
}}
/>
<Radio
label={getI18n(this.props.langId, 'LDAP')}
name='loginProvider'
value='ldap'
checked={this.props.loginProvider === 'ldap'}
onChange={(e,data) => {
this.props.setLoginProvider('ldap')
}}
/>
{/*<Radio*/}
{/* label={getI18n(this.props.langId, 'LDAP')}*/}
{/* name='loginProvider'*/}
{/* value='ldap'*/}
{/* checked={this.props.loginProvider === 'ldap'}*/}
{/* onChange={(e,data) => {*/}
{/* this.props.setLoginProvider('ldap')*/}
{/* }}*/}
{/*/>*/}
</div>
</Form.Field>
......
......@@ -117,7 +117,11 @@ class OwnInformationSettingsView extends React.Component<Props, any> {
email: this.props.userDataCopy.email,
oldPassword: cryptoHelper.hash(
this.props.userDataCopy.oldPassword),
oldPasswordBase64: cryptoHelper.hashBase64(
this.props.userDataCopy.oldPassword),
newPassword: cryptoHelper.hash(
this.props.userDataCopy.newPassword),
newPasswordBase64: cryptoHelper.hashBase64(
this.props.userDataCopy.newPassword)
})
}}
......
......@@ -13,7 +13,7 @@ import Logger from './helpers/logger'
* y - breaking changes / new features
* z - fixes, small changes
*/
export const versionString = '2.12.0'
export const versionString = '2.13.0'
export const supportMail = 'yapex@informatik.uni-halle.de'
......
......@@ -18,3 +18,12 @@ export function hash(pw: string): string {
return crypto.SHA512(pw).toString(crypto.enc.Hex)
}
export function hashBase64(pw: string): string {
if (!crypto) {
throw new Error('no cryptojs found !')
}
return crypto.SHA256(pw).toString(crypto.enc.Base64)
}
......@@ -61,8 +61,10 @@ export function reducer(state: State = initial, action: AllActions): State {
userDataCopy: {
email: action.payload.email,
oldPassword: '',
oldPasswordBase64: '',
newPassword: '',
newPasswordCheck: '',
newPasswordBase64: '',
isValid: false
},
userSettingsCopy: action.payload.settings
......
......@@ -140,8 +140,10 @@ export function reducer(state: State = initial, action: AllActions): State {
userDataCopy: {
email: action.userData.email,
oldPassword: '',
oldPasswordBase64: '',
newPassword: '',
newPasswordCheck: '',
newPasswordBase64: '',
isValid: false
},
userSettingsCopy: action.userData.settings
......
......@@ -19,7 +19,9 @@ export const initial: State = {
email: '',
newPassword: '',
oldPassword: '',
oldPasswordBase64: '',
newPasswordCheck: '',
newPasswordBase64: '',
isValid: false
}
......@@ -27,6 +29,8 @@ export const validationRules = getValidationCollection<EmailAndPasswordTuple>({
email: [isEmailAndNotEmpty],
newPassword: [isEmptyOrNotSpaces],
oldPassword: [],
oldPasswordBase64: [],
newPasswordBase64: [],
})
......
......@@ -7,4 +7,6 @@ export const validationMessageKeys = getValidationMessagesCollection<EmailAndPas
email: getI18n(globalState.getState().i18nState.langId,'Field value is not a valid email'),
newPassword: getI18n(globalState.getState().i18nState.langId,'Field must not be empty or just whitespaces'),
oldPassword: '', //can be empty if the user is new??
})
\ No newline at end of file
oldPasswordBase64: '',
newPasswordBase64: '',
})
......@@ -11,6 +11,7 @@
export interface LoginCredentialsForBackend {
readonly token: string
readonly password: string
readonly passwordBase64: string
}
export interface RegisterUserForBackend {
......@@ -19,4 +20,4 @@ export interface RegisterUserForBackend {
readonly firstName: string
readonly lastName: string
readonly email: string
}
\ No newline at end of file
}
......@@ -152,10 +152,15 @@ export interface EmailAndPasswordTuple {
* the old password to verify that the user is allowed to change his/her password
*/
readonly oldPassword: string
readonly oldPasswordBase64: string
/**
* the new password
*/
readonly newPassword: string
/**
* password base64 encoded
*/
readonly newPasswordBase64: string
}
/**
* the data to set the new user data (called by an admin)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment