Merge branch 'master' into electron

master
kunkka 4 years ago
commit 36fa7b312a

@ -34,3 +34,19 @@ export function isUsernameLoggedIn() {
export function isLooseLoggedIn() { export function isLooseLoggedIn() {
return isAccountLoggedIn() || isUsernameLoggedIn(); return isAccountLoggedIn() || isUsernameLoggedIn();
} }
export function getMusicU(string) {
const temp = string.split(';')
if (!temp.length) {
return undefined
}
const MUSIC_U = temp.find(item => item.includes('MUSIC_U'))
if (MUSIC_U) {
return MUSIC_U.split('=')[1]
}
return ''
}
export function setMusicU(key, value) {
return Cookies.set(key, value)
}

@ -89,6 +89,7 @@ import { loginWithPhone, loginWithEmail } from "@/api/auth";
import md5 from "crypto-js/md5"; import md5 from "crypto-js/md5";
import { mapMutations } from "vuex"; import { mapMutations } from "vuex";
import { userPlaylist } from "@/api/user"; import { userPlaylist } from "@/api/user";
import { getMusicU, setMusicU } from '@/utils/auth';
export default { export default {
name: "Login", name: "Login",
@ -177,6 +178,10 @@ export default {
md5_password: md5(this.password).toString(), md5_password: md5(this.password).toString(),
}) })
.then((data) => { .then((data) => {
// MUSIC_U cookie
// 301
const MUSIC_U = getMusicU(data.cookie)
setMusicU('MUSIC_U', MUSIC_U)
if (data.code !== 502) { if (data.code !== 502) {
this.updateData({ key: "user", value: data.profile }); this.updateData({ key: "user", value: data.profile });
this.afterLogin(); this.afterLogin();

Loading…
Cancel
Save