Login button, dont show logout button if logged in, add login/register buttons to login/register

This commit is contained in:
Karlis Cudars 2021-10-24 01:42:15 +03:00
parent 988fec8ed2
commit ab4fa6ee8d
5 changed files with 46 additions and 3 deletions

View file

@ -31,6 +31,10 @@
</a> </a>
</div> </div>
</form> </form>
<router-link to="/register" style="background: none !important;">
Register
</router-link>
</div> </div>
</template> </template>

View file

@ -85,6 +85,7 @@
</router-link> </router-link>
<button <button
v-if="authenticated"
class="highlight logout-button button sidebar-link uk-width-1-1 uk-flex uk-flex-center uk-flex-middle" class="highlight logout-button button sidebar-link uk-width-1-1 uk-flex uk-flex-center uk-flex-middle"
:style="{ backgroundColor: backgroundColor }" :style="{ backgroundColor: backgroundColor }"
style="border-radius: 9999px; border: none; margin-top: 20px;" style="border-radius: 9999px; border: none; margin-top: 20px;"
@ -93,6 +94,17 @@
<span v-if="!hideText" v-t="'actions.logout'" /> <span v-if="!hideText" v-t="'actions.logout'" />
<font-awesome-icon icon="sign-out-alt" /> <font-awesome-icon icon="sign-out-alt" />
</button> </button>
<button
v-if="!authenticated"
class="highlight logout-button button sidebar-link uk-width-1-1 uk-flex uk-flex-center uk-flex-middle"
:style="{ backgroundColor: backgroundColor }"
style="border-radius: 9999px; border: none; margin-top: 20px;"
@click="openLogin()"
>
<span v-if="!hideText" v-t="'actions.login_or_register'" />
<font-awesome-icon icon="sign-out-alt" />
</button>
</div> </div>
</template> </template>
@ -135,6 +147,9 @@ export default {
this.removePreference("authToken" + this.hashCode(this.apiUrl())); this.removePreference("authToken" + this.hashCode(this.apiUrl()));
window.location = "/"; // done to bypass cache window.location = "/"; // done to bypass cache
}, },
openLogin() {
this.$router.push("/login");
},
}, },
computed: { computed: {
enableAnimations(_this) { enableAnimations(_this) {

View file

@ -21,9 +21,13 @@
<font-awesome-icon class="button highlight" @click="toggleCollapsed()" icon="bars" /> <font-awesome-icon class="button highlight" @click="toggleCollapsed()" icon="bars" />
</div> </div>
<div class="uk-flex uk-flex-middle" style="gap: 12px;" v-if="!hideText"> <div class="uk-flex uk-flex-middle" style="gap: 12px;" v-if="!hideText">
<img src="/img/pipedPlay.svg" style="height: 26px;" /> <router-link to="/" style="background: none !important;">
<img src="/img/pipedPlay.svg" style="height: 26px;" />
</router-link>
<img src="/img/piped.svg" style="height: 22px;" /> <router-link to="/" style="background: none !important;">
<img src="/img/piped.svg" style="height: 22px;" />
</router-link>
</div> </div>
</div> </div>
@ -61,12 +65,24 @@
</router-link> </router-link>
<button <button
v-if="authenticated"
class="highlight logout-button button sidebar-link uk-width-1-1 uk-flex uk-flex-center uk-flex-middle" class="highlight logout-button button sidebar-link uk-width-1-1 uk-flex uk-flex-center uk-flex-middle"
:style="{ backgroundColor: backgroundColor }" :style="{ backgroundColor: backgroundColor }"
style="border-radius: 9999px; border: none; margin-top: 20px;" style="border-radius: 9999px; border: none; margin-top: 20px;"
@click="logout()" @click="logout()"
> >
<span v-t="'actions.logout'" /> <span v-if="!hideText" v-t="'actions.logout'" />
<font-awesome-icon icon="sign-out-alt" />
</button>
<button
v-if="!authenticated"
class="highlight logout-button button sidebar-link uk-width-1-1 uk-flex uk-flex-center uk-flex-middle"
:style="{ backgroundColor: backgroundColor }"
style="border-radius: 9999px; border: none; margin-top: 20px;"
@click="openLogin()"
>
<span v-if="!hideText" v-t="'actions.login_or_register'" />
<font-awesome-icon icon="sign-out-alt" /> <font-awesome-icon icon="sign-out-alt" />
</button> </button>
</div> </div>
@ -85,6 +101,9 @@ export default {
this.removePreference("authToken" + this.hashCode(this.apiUrl())); this.removePreference("authToken" + this.hashCode(this.apiUrl()));
window.location = "/"; // done to bypass cache window.location = "/"; // done to bypass cache
}, },
openLogin() {
window.location = "/login"; // done to bypass cache
},
}, },
computed: { computed: {
enableAnimations(_this) { enableAnimations(_this) {

View file

@ -31,6 +31,10 @@
> >
</div> </div>
</form> </form>
<router-link to="/login" style="background: none !important;">
Login
</router-link>
</div> </div>
</template> </template>

View file

@ -12,6 +12,7 @@
"watch_on": "Watch on" "watch_on": "Watch on"
}, },
"actions": { "actions": {
"login_or_register": "Log in or Register",
"logout": "Log out", "logout": "Log out",
"subscribe": "Subscribe", "subscribe": "Subscribe",
"unsubscribe": "Unsubscribe", "unsubscribe": "Unsubscribe",