mirror of
https://github.com/WebTools-NG/WebTools-NG
synced 2024-11-23 03:23:05 +00:00
#196 fixed
This commit is contained in:
parent
d9d0e0c68f
commit
e0de53b409
3 changed files with 26 additions and 13 deletions
|
@ -37,7 +37,9 @@
|
|||
"Password": "Password",
|
||||
"PasswordPrompt": "Enter your plex.tv password",
|
||||
"UsernameSave": "Remember Username",
|
||||
"LoginBtn": "Sign in"
|
||||
"LoginBtn": "Sign in",
|
||||
"twoFA": "2Factor Authentication Code",
|
||||
"twoFAPrompt": "If using 2FA, enter your code here, else leave as blank (optional)"
|
||||
},
|
||||
"SelServer": "Select Server",
|
||||
"Menu": {
|
||||
|
|
|
@ -31,6 +31,14 @@
|
|||
<b-form-input type="password" id="input-2" v-model="input.password" trim></b-form-input>
|
||||
</b-form-group>
|
||||
|
||||
<b-form-group
|
||||
id="fieldset-3"
|
||||
:description="$t('Common.Login.twoFAPrompt')"
|
||||
:label="$t('Common.Login.twoFA')"
|
||||
label-for="input-1">
|
||||
<b-form-input id="input-3" v-model="input.twoFA" trim></b-form-input>
|
||||
</b-form-group>
|
||||
|
||||
<b-form-group>
|
||||
<b-form-checkbox
|
||||
id="checkbox-1"
|
||||
|
@ -91,7 +99,8 @@ export default {
|
|||
plexLogin(){
|
||||
store.dispatch('loginToPlex', {
|
||||
username: this.input.username,
|
||||
password: this.input.password
|
||||
password: this.input.password,
|
||||
twoFA: this.input.twoFA
|
||||
})
|
||||
|
||||
if(this.checkbox){
|
||||
|
|
|
@ -101,21 +101,23 @@ const actions = {
|
|||
},
|
||||
loginToPlex({ commit }, payload){
|
||||
log.info("loginToPlex called")
|
||||
var url = 'https://plex.tv/api/v2/users/signin';
|
||||
url = url + '?login=' + payload.username;
|
||||
url = url + '&password=' + payload.password;
|
||||
if ( payload.twoFA ){
|
||||
url = url + '&verificationCode=' + payload.twoFA
|
||||
}
|
||||
axios({
|
||||
method: 'POST',
|
||||
url: 'https://plex.tv/users/sign_in.json',
|
||||
auth: {
|
||||
username : payload.username,
|
||||
password: payload.password
|
||||
},
|
||||
url: url,
|
||||
headers: wtutils.PMSHeader
|
||||
})
|
||||
.then(function (response) {
|
||||
log.debug('loginToPlex: Response from fetchPlexServers recieved')
|
||||
commit('UPDATE_AUTHTOKEN', response.data.user.authToken)
|
||||
commit('UPDATE_AUTHTOKEN', response.data.authToken)
|
||||
commit('UPDATE_AUTHENTICATED', true)
|
||||
commit('UPDATE_AVATAR', response.data.user.thumb)
|
||||
commit('UPDATE_PLEXNAME', response.data.user.username)
|
||||
commit('UPDATE_AVATAR', response.data.thumb)
|
||||
commit('UPDATE_PLEXNAME', response.data.username)
|
||||
router.replace({name: "home"});
|
||||
})
|
||||
.catch(function (error) {
|
||||
|
|
Loading…
Reference in a new issue