This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static string CreateAuthHeader() | |
{ | |
var dateToSign = DateTime.UtcNow.ToString("ddd, dd MMM yyyy HH':'mm':'ss 'GMT'", new CultureInfo("en-US")); | |
var stringToSign = $"{dateToSign}\n/{STORAGE_ACCOUNT_NAME}/{TABLE_NAME}"; | |
string signature; | |
using (var hmacSha256 = new HMACSHA256(Convert.FromBase64String(STORAGE_ACCOUNT_KEY))) | |
{ | |
var dataToHmac = Encoding.UTF8.GetBytes(stringToSign); | |
signature = Convert.ToBase64String(hmacSha256.ComputeHash(dataToHmac)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import CustomLink from "./CustomLink"; | |
export const Header = () => { | |
return ( | |
<> | |
<CustomLink condition="signedIn" to="/logout"> | |
Logout | |
</CustomLink> | |
<CustomLink condition="signedOut" to="/login"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useState } from "react"; | |
import { connect } from "react-redux"; | |
import { Link } from "react-router-dom"; | |
const CustomLink = props => { | |
const [returnedLink, setReturnedLink] = useState(null); | |
useEffect(() => { | |
switch (props.condition) { | |
case "teacher": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { connect } from "react-red"; | |
import { Link } from "react-router-dom"; | |
export const Header = ({ user }) => { | |
return ( | |
<> | |
{user.isSignedIn ? ( | |
<Link to="/logout">Logout</Link> | |
) : ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useState } from "react"; | |
import { connect } from "react-redux"; | |
import { Redirect, Route } from "react-router-dom"; | |
const CustomRoute = props => { | |
const [returnedRoute, setReturnedRoute] = useState(""); | |
useEffect(() => { | |
switch (props.condition) { | |
case "teacher": | |
return setReturnedRoute( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { Switch } from "react-router-dom"; | |
import CustomRoute from "./CustomRoute"; | |
import MainIndex from "./MainIndex"; | |
import LoginPage from "./LoginPage"; | |
import RestrictedPage from "./RestrictedPage"; | |
import OnlyTeacher from "./OnlyTeacher"; | |
import OnlyStudent from "./OnlyStudent"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { Switch, Route, Redirect } from "react-router-dom"; | |
import { connect } from "react-redux"; | |
import MainIndex from "./MainIndex"; | |
import LoginPage from "./LoginPage"; | |
import RestrictedPage from "./RestrictedPage"; | |
import OnlyTeacher from "./OnlyTeacher"; | |
import OnlyStudent from "./OnlyStudent"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { Switch, Route } from "react-router-dom"; | |
import { connect } from "react-redux"; | |
import MainIndex from "./MainIndex"; | |
import LoginPage from "./LoginPage"; | |
import RestrictedPage from "./RestrictedPage"; | |
import OnlyTeacher from "./OnlyTeacher"; | |
import OnlyStudent from "./OnlyStudent"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const passwordConfirmationRule = value => { | |
let password = document.getElementById("password"); | |
return value === password.value | |
? false | |
: "Password confirmation must match password."; | |
}; | |
export const emailRule = value => { | |
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value) ? false : "Not a valid email."; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { mount } from "enzyme"; | |
import FlashMessage from "./FlashMessage"; | |
import { act } from "react-dom/test-utils"; | |
describe("FlashMessage", () => { | |
let container, messageMock; | |
beforeEach(() => { | |
jest.useFakeTimers(); | |
messageMock = "Test message"; |
NewerOlder